package com.jshcbd.modules.asset.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jshcbd.modules.asset.entity.AddressEntity;
import com.jshcbd.modules.asset.entity.CompanyEntity;
import com.jshcbd.modules.asset.vo.AddressVo;
import com.jshcbd.modules.asset.vo.InventoryItemVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author zhoucd
 * @date
 * @description
 */
public interface AddressMapper extends BaseMapper<AddressEntity> {



    @Select("SELECT * FROM(SELECT A.*,B.NAME COMPANY_NAME  FROM ADDRESS A LEFT JOIN COMPANY B ON B.ID = A.COMPANY_ID) " +
            "TEMP ${ew.customSqlSegment} ")
    Page<AddressVo> queryPageView(Page<AddressVo> page, @Param(Constants.WRAPPER) Wrapper wrapper);


    @Select("SELECT * FROM(SELECT A.*,B.NAME COMPANY_NAME FROM ADDRESS A LEFT JOIN COMPANY B ON B.ID = A.COMPANY_ID) " +
            "TEMP WHERE ID = #{id} ")
    AddressVo queryViewById(String id);

    @Select("SELECT * FROM(SELECT A.*,B.NAME COMPANY_NAME FROM ADDRESS A LEFT JOIN COMPANY B ON B.ID = A.COMPANY_ID) " +
            "TEMP WHERE RFID = #{rfid} ")
    AddressVo queryViewByRFID(String rfid);


}
